<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@ include file="../../base/top.jsp" %>
    <style>
        li {
            list-style-type: none;
        }
    </style>
</head>
<body>
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div align="left">
                            <i class="glyphicon glyphicon-plus" aria-hidden="true"
                               id="createTask">创建任务</i>
                        </div>

                        <div class="main" style="padding-top:10px;">
                            <ul class="logo-list clearfix">

                                <c:forEach items="${taskDetails}" var="taskDetail" varStatus="status">
                                    <li class="one-fifth">
                                        <div class="btn btn-mini btn-light" style="width: 100%;height: 100%;">
                                            <font size="2">
                                                <div style="float: left;">
                                                    <div>
                                                        <div class="name" align="left">
                                                            <div style="float: left">
                                                                <a target="mainFrame" class= "editTask" value = '{"taskId":"${taskDetail.taskId}","taskName":"${taskDetail.taskName}","taskType":"${taskDetail.taskType}","taskStartTime":"${taskDetail.taskStartTime}","taskEndTime":"${taskDetail.taskEndTime}","taskDescription":"${taskDetail.taskDescription}"}'>
                                                                        ${taskDetail.taskName}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                </a>
                                                            </div>
                                                            <div class="name">
                                                                开始时间：<fmt:formatDate value="${taskDetail.taskStartTime}"
                                                                                     pattern="yyyy-MM-dd HH:mm"/>&nbsp;&nbsp;&nbsp;&nbsp;
                                                                截止时间：<fmt:formatDate value="${taskDetail.taskEndTime}"
                                                                                     pattern="yyyy-MM-dd HH:mm"/>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div align="left" style="padding-left: 15px;">
                                                        任务要求：<br/>
                                                        &nbsp;&nbsp;&nbsp;&nbsp;${taskDetail.taskDescription}
                                                    </div>
                                                </div>
                                                <div style="float: right;">
                                                    <div>
                                                        <div class="name">
                                                            |已批(${taskDetail.batchNumber})|未批(${taskDetail.noBatchNumber})|未交(${taskDetail.unfinishNumber})
                                                        </div>
                                                    </div>
                                                </div>
                                            </font>
                                        </div>
                                    </li>
                                    <br/>
                                </c:forEach>

                            </ul>
                        </div>
                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.page-content -->
        </div>
    </div>
    <!-- /.main-content -->
    <!-- 返回顶部 -->
    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>
</div>

<!-- basic scripts -->
<!-- 页面底部js¨ -->
<%@ include file="../../base/foot.jsp" %>

<script type="text/javascript">
    $(top.hangge());//关闭加载状态
    function openDialog(url) {
        var diag = new top.Dialog();
        diag.Drag=true;
        diag.Title ="编辑";
        diag.URL = url;
        diag.Width = 550;
        diag.Height = 368;
        diag.CancelEvent = function(){ //关闭事件
            var success = diag.innerFrame.contentWindow.document.getElementById('success').value;
            var msg = diag.innerFrame.contentWindow.document.getElementById('msg').value;
            diag.close();
            if("true" == success ){
                prompt_alert('success',msg,2);
            }else if("false" == success){
                prompt_alert('error',msg,2);
            }
        };
        diag.show();
    }
    $("#createTask").click(function () {
        openDialog('<%=basePath%>task/to_add_task?teachCourseId=${teachCourseId}');
    });
    $(".editTask").each(function () {
        $(this).click(function () {
            openDialog('<%=basePath%>task/to_edit_task?teachCourseId=${teachCourseId}&'+parseParam(JSON.parse($(this).attr("value"))));
        });
    });

</script>
</body>
</html>
